```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>内存使用分析与泄漏排查指南</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero {
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
        }
        .card {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        }
        .tool-card {
            border-left: 4px solid #4f46e5;
        }
        .step-card {
            border-left: 4px solid #10b981;
        }
        .code-block {
            background-color: #2d3748;
            color: #f8fafc;
            border-radius: 0.375rem;
        }
        .list-item {
            position: relative;
            padding-left: 1.5rem;
        }
        .list-item:before {
            content: "•";
            position: absolute;
            left: 0;
            color: #4f46e5;
            font-weight: bold;
        }
        .section-divider {
            border: none;
            height: 1px;
            background: linear-gradient(to right, transparent, #cbd5e0, transparent);
            margin: 3rem 0;
        }
        .floating-button {
            position: fixed;
            bottom: 2rem;
            right: 2rem;
            z-index: 50;
            transition: all 0.3s ease;
        }
        .floating-button:hover {
            transform: scale(1.1);
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <div class="hero py-20 px-4 sm:px-6 lg:px-8">
        <div class="max-w-7xl mx-auto text-center">
            <h1 class="text-4xl md:text-5xl font-bold text-gray-900 mb-6">内存使用分析与泄漏排查指南</h1>
            <p class="text-xl text-gray-700 max-w-3xl mx-auto mb-8">
                掌握高效诊断和解决Java应用程序内存问题的完整方法论
            </p>
            <div class="flex justify-center space-x-4">
                <a href="#overview" class="px-6 py-3 bg-indigo-600 text-white font-medium rounded-md hover:bg-indigo-700 transition duration-300">
                    开始探索
                </a>
                <a href="#tools" class="px-6 py-3 bg-white text-indigo-600 font-medium rounded-md border border-indigo-600 hover:bg-indigo-50 transition duration-300">
                    工具介绍
                </a>
            </div>
        </div>
    </div>

    <!-- Main Content -->
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
        <!-- Overview Section -->
        <section id="overview" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="flex-shrink-0 h-12 w-12 rounded-full bg-indigo-100 flex items-center justify-center">
                    <i class="fas fa-memory text-indigo-600 text-xl"></i>
                </div>
                <h2 class="ml-4 text-3xl font-bold text-gray-900">内存使用情况概述</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div>
                    <p class="text-lg text-gray-700 mb-6">
                        大型Java应用程序和系统中，内存管理是确保系统性能和稳定性的关键因素。作为开发人员或运维工程师，我们常常会遇到系统内存使用异常的问题，尤其是在长时间运行的应用程序中，内存泄漏可能会导致系统的性能逐渐下降，甚至崩溃。
                    </p>
                    <div class="bg-white rounded-lg shadow-md p-6 card">
                        <h3 class="text-xl font-semibold text-gray-800 mb-4">关键概念</h3>
                        <ul class="space-y-3">
                            <li class="list-item"><span class="font-medium">物理内存</span>：系统实际安装的RAM</li>
                            <li class="list-item"><span class="font-medium">虚拟内存</span>：操作系统提供的抽象内存空间</li>
                            <li class="list-item"><span class="font-medium">静态内存分配</span>：编译时决定的内存分配</li>
                            <li class="list-item"><span class="font-medium">动态内存分配</span>：运行时动态分配内存</li>
                        </ul>
                    </div>
                </div>
                <div class="bg-white rounded-lg overflow-hidden shadow-md">
                    <img src="https://cdn.nlark.com/yuque/0/2024/png/21449790/1725764920023-bc447074-5bc6-4482-9ee7-8330e4d1e076.png" alt="内存结构图示" class="w-full h-auto object-cover">
                </div>
            </div>

            <div class="mt-8">
                <h3 class="text-2xl font-semibold text-gray-800 mb-6">内存管理机制</h3>
                <div class="grid md:grid-cols-3 gap-6">
                    <div class="bg-white rounded-lg p-6 shadow-md card">
                        <div class="flex items-center mb-4">
                            <div class="flex-shrink-0 h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center">
                                <i class="fas fa-layer-group text-blue-600"></i>
                            </div>
                            <h4 class="ml-3 text-lg font-medium text-gray-900">内存分页</h4>
                        </div>
                        <p class="text-gray-600">将内存划分为固定大小的页面，在物理内存和磁盘之间进行管理，使用虚拟内存扩展物理内存。</p>
                    </div>
                    <div class="bg-white rounded-lg p-6 shadow-md card">
                        <div class="flex items-center mb-4">
                            <div class="flex-shrink-0 h-10 w-10 rounded-full bg-green-100 flex items-center justify-center">
                                <i class="fas fa-project-diagram text-green-600"></i>
                            </div>
                            <h4 class="ml-3 text-lg font-medium text-gray-900">内存段</h4>
                        </div>
                        <p class="text-gray-600">将内存分成不同段，每个段可以动态增长或缩小，提供更多灵活性但管理更复杂。</p>
                    </div>
                    <div class="bg-white rounded-lg p-6 shadow-md card">
                        <div class="flex items-center mb-4">
                            <div class="flex-shrink-0 h-10 w-10 rounded-full bg-purple-100 flex items-center justify-center">
                                <i class="fas fa-trash-alt text-purple-600"></i>
                            </div>
                            <h4 class="ml-3 text-lg font-medium text-gray-900">垃圾回收</h4>
                        </div>
                        <p class="text-gray-600">自动管理内存，定期释放不再使用的内存空间，减少内存泄漏风险。</p>
                    </div>
                </div>
            </div>
        </section>

        <hr class="section-divider">

        <!-- System Tools Section -->
        <section id="tools" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="flex-shrink-0 h-12 w-12 rounded-full bg-blue-100 flex items-center justify-center">
                    <i class="fas fa-tools text-blue-600 text-xl"></i>
                </div>
                <h2 class="ml-4 text-3xl font-bold text-gray-900">系统工具分析内存使用</h2>
            </div>

            <div class="grid gap-8">
                <div class="bg-white rounded-lg shadow-md overflow-hidden tool-card">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <h3 class="text-xl font-semibold text-gray-800">free 命令</h3>
                            <span class="ml-auto bg-blue-100 text-blue-800 text-xs font-medium px-2.5 py-0.5 rounded">基础工具</span>
                        </div>
                        <p class="text-gray-600 mb-4">显示系统的总内存、已用内存、空闲内存以及缓存和缓冲区的使用情况。</p>
                        <div class="code-block p-4 mb-4">
                            <code class="text-sm text-white">free -m</code>
                        </div>
                        <div class="bg-gray-100 p-4 rounded-md">
                            <p class="text-sm text-gray-700 mb-2"><span class="font-medium">输出解析：</span></p>
                            <ul class="text-sm text-gray-700 space-y-1">
                                <li><span class="font-medium">total</span>: 总内存量</li>
                                <li><span class="font-medium">used</span>: 已用内存量，包括缓存和缓冲区</li>
                                <li><span class="font-medium">free</span>: 空闲内存量</li>
                                <li><span class="font-medium">buff/cache</span>: 用作缓存和缓冲区的内存量</li>
                            </ul>
                        </div>
                    </div>
                </div>

                <div class="bg-white rounded-lg shadow-md overflow-hidden tool-card">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <h3 class="text-xl font-semibold text-gray-800">top 命令</h3>
                            <span class="ml-auto bg-green-100 text-green-800 text-xs font-medium px-2.5 py-0.5 rounded">实时监控</span>
                        </div>
                        <p class="text-gray-600 mb-4">实时显示系统的内存使用情况和进程状态，帮助监控内存使用和识别高内存占用的进程。</p>
                        <div class="code-block p-4 mb-4">
                            <code class="text-sm text-white">top</code>
                        </div>
                        <div class="grid md:grid-cols-2 gap-4">
                            <div class="bg-gray-100 p-4 rounded-md">
                                <p class="text-sm text-gray-700 mb-2"><span class="font-medium">关键指标：</span></p>
                                <ul class="text-sm text-gray-700 space-y-1">
                                    <li>KiB Mem: 内存使用情况</li>
                                    <li>KiB Swap: 交换区使用情况</li>
                                    <li>进程内存占用排序</li>
                                </ul>
                            </div>
                            <div class="bg-gray-100 p-4 rounded-md">
                                <p class="text-sm text-gray-700 mb-2"><span class="font-medium">使用技巧：</span></p>
                                <ul class="text-sm text-gray-700 space-y-1">
                                    <li>按内存排序: <code class="bg-gray-200 px-1 rounded">Shift+M</code></li>
                                    <li>查看完整命令行: <code class="bg-gray-200 px-1 rounded">c</code></li>
                                    <li>退出: <code class="bg-gray-200 px-1 rounded">q</code></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="bg-white rounded-lg shadow-md overflow-hidden tool-card">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <h3 class="text-xl font-semibold text-gray-800">vmstat 命令</h3>
                            <span class="ml-auto bg-purple-100 text-purple-800 text-xs font-medium px-2.5 py-0.5 rounded">系统分析</span>
                        </div>
                        <p class="text-gray-600 mb-4">提供内存、交换区、I/O、系统活动的统计信息，用于深入分析系统性能。</p>
                        <div class="code-block p-4 mb-4">
                            <code class="text-sm text-white">vmstat 1</code>
                        </div>
                        <div class="bg-gray-100 p-4 rounded-md">
                            <p class="text-sm text-gray-700 mb-2"><span class="font-medium">输出字段：</span></p>
                            <ul class="text-sm text-gray-700 space-y-1">
                                <li><span class="font-medium">memory</span>: 交换区、空闲内存、缓存使用情况</li>
                                <li><span class="font-medium">swap</span>: 交换区使用情况</li>
                                <li><span class="font-medium">io</span>: 块设备读写速率</li>
                                <li><span class="font-medium">cpu</span>: CPU使用情况</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <hr class="section-divider">

        <!-- Leak Identification Section -->
        <section id="identification" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="flex-shrink-0 h-12 w-12 rounded-full bg-red-100 flex items-center justify-center">
                    <i class="fas fa-search text-red-600 text-xl"></i>
                </div>
                <h2 class="ml-4 text-3xl font-bold text-gray-900">内存泄漏的识别</h2>
            </div>

            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div>
                    <h3 class="text-2xl font-semibold text-gray-800 mb-6">内存泄漏的表现</h3>
                    <div class="space-y-4">
                        <div class="flex items-start">
                            <div class="flex-shrink-0 mt-1">
                                <div class="h-5 w-5 rounded-full bg-red-100 flex items-center justify-center">
                                    <i class="fas fa-exclamation text-red-600 text-xs"></i>
                                </div>
                            </div>
                            <div class="ml-3">
                                <h4 class="text-lg font-medium text-gray-900">性能下降</h4>
                                <p class="text-gray-600">内存泄漏通常导致系统性能逐渐下降，未释放的内存逐渐增多，引起响应变慢或系统挂起。</p>
                            </div>
                        </div>
                        <div class="flex items-start">
                            <div class="flex-shrink-0 mt-1">
                                <div class="h-5 w-5 rounded-full bg-red-100 flex items-center justify-center">
                                    <i class="fas fa-skull text-red-600 text-xs"></i>
                                </div>
                            </div>
                            <div class="ml-3">
                                <h4 class="text-lg font-medium text-gray-900">系统崩溃</h4>
                                <p class="text-gray-600">如果内存泄漏严重，系统可能会因为内存耗尽而崩溃或变得不可用。</p>
                            </div>
                        </div>
                        <div class="flex items-start">
                            <div class="flex-shrink-0 mt-1">
                                <div class="h-5 w-5 rounded-full bg-red-100 flex items-center justify-center">
                                    <i class="fas fa-chart-line text-red-600 text-xs"></i>
                                </div>
                            </div>
                            <div class="ml-3">
                                <h4 class="text-lg font-medium text-gray-900">高内存使用率</h4>
                                <p class="text-gray-600">持续的内存使用率上升，尤其是在长时间运行的应用程序中，可能是内存泄漏的迹象。</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div>
                    <h3 class="text-2xl font-semibold text-gray-800 mb-6">应用级别分析工具</h3>
                    <div class="bg-white rounded-lg shadow-md p-6">
                        <div class="space-y-4">
                            <div>
                                <h4 class="font-medium text-gray-900">jstat 工具</h4>
                                <div class="code-block p-2 mt-1 mb-2">
                                    <code class="text-xs text-white">jstat -gc &lt;pid&gt;</code>
                                </div>
                                <p class="text-sm text-gray-600">监控JVM内存使用情况和垃圾回收统计信息</p>
                            </div>
                            <div>
                                <h4 class="font-medium text-gray-900">jmap 工具</h4>
                                <div class="code-block p-2 mt-1 mb-2">
                                    <code class="text-xs text-white">jmap -dump:format=b,file=heapdump.hprof &lt;pid&gt;</code>
                                </div>
                                <p class="text-sm text-gray-600">生成Java应用程序的堆转储，用于内存分析</p>
                            </div>
                            <div>
                                <h4 class="font-medium text-gray-900">VisualVM</h4>
                                <p class="text-sm text-gray-600">图形化界面监控JVM内存使用情况，生成堆转储</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <h3 class="text-2xl font-semibold text-gray-800 mb-6">堆转储分析流程</h3>
            <div class="grid md:grid-cols-4 gap-4 mb-8">
                <div class="bg-white rounded-lg p-4 shadow-md text-center step-card">
                    <div class="h-12 w-12 mx-auto rounded-full bg-green-100 flex items-center justify-center mb-3">
                        <span class="text-green-600 font-bold">1</span>
                    </div>
                    <h4 class="font-medium text-gray-900">生成堆转储</h4>
                    <p class="text-sm text-gray-600 mt-1">使用jmap或类似工具生成堆转储文件</p>
                </div>
                <div class="bg-white rounded-lg p-4 shadow-md text-center step-card">
                    <div class="h-12 w-12 mx-auto rounded-full bg-green-100 flex items-center justify-center mb-3">
                        <span class="text-green-600 font-bold">2</span>
                    </div>
                    <h4 class="font-medium text-gray-900">导入MAT</h4>
                    <p class="text-sm text-gray-600 mt-1">将堆转储文件导入Memory Analyzer Tool</p>
                </div>
                <div class="bg-white rounded-lg p-4 shadow-md text-center step-card">
                    <div class="h-12 w-12 mx-auto rounded-full bg-green-100 flex items-center justify-center mb-3">
                        <span class="text-green-600 font-bold">3</span>
                    </div>
                    <h4 class="font-medium text-gray-900">分析泄漏</h4>
                    <p class="text-sm text-gray-600 mt-1">使用MAT的泄漏检测功能识别问题</p>
                </div>
                <div class="bg-white rounded-lg p-4 shadow-md text-center step-card">
                    <div class="h-12 w-12 mx-auto rounded-full bg-green-100 flex items-center justify-center mb-3">
                        <span class="text-green-600 font-bold">4</span>
                    </div>
                    <h4 class="font-medium text-gray-900">定位问题</h4>
                    <p class="text-sm text-gray-600 mt-1">检查Dominators视图和对象保留链</p>
                </div>
            </div>
        </section>

        <hr class="section-divider">

        <!-- Diagnostic Tools Section -->
        <section id="diagnostic" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="flex-shrink-0 h-12 w-12 rounded-full bg-purple-100 flex items-center justify-center">
                    <i class="fas fa-stethoscope text-purple-600 text-xl"></i>
                </div>
                <h2 class="ml-4 text-3xl font-bold text-gray-900">内存泄漏的诊断工具</h2>
            </div>

            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div>
                    <h3 class="text-2xl font-semibold text-gray-800 mb-6">JVM诊断工具</h3>
                    <div class="space-y-6">
                        <div class="bg-white rounded-lg shadow-md p-6">
                            <div class="flex items-center mb-3">
                                <h4 class="text-lg font-medium text-gray-900">jmap</h4>
                                <span class="ml-auto bg-purple-100 text-purple-800 text-xs font-medium px-2.5 py-0.5 rounded">堆转储</span>
                            </div>
                            <p class="text-gray-600 mb-3">用于生成Java堆转储的工具，堆转储是内存泄漏分析的基础。</p>
                            <div class="code-block p-3">
                                <code class="text-xs text-white">jmap -dump:format=b,file=heapdump.hprof &lt;pid&gt;</code>
                            </div>
                        </div>
                        <div class="bg-white rounded-lg shadow-md p-6">
                            <div class="flex items-center mb-3">
                                <h4 class="text-lg font-medium text-gray-900">VisualVM</h4>
                                <span class="ml-auto bg-blue-100 text-blue-800 text-xs font-medium px-2.5 py-0.5 rounded">图形化</span>
                            </div>
                            <p class="text-gray-600">提供图形化界面来分析内存使用，包括内存快照、堆转储分析和性能监控。</p>
                        </div>
                    </div>
                </div>
                <div>
                    <h3 class="text-2xl font-semibold text-gray-800 mb-6">内存分析工具</h3>
                    <div class="space-y-6">
                        <div class="bg-white rounded-lg shadow-md p-6">
                            <div class="flex items-center mb-3">
                                <h4 class="text-lg font-medium text-gray-900">Eclipse MAT</h4>
                                <span class="ml-auto bg-green-100 text-green-800 text-xs font-medium px-2.5 py-0.5 rounded">免费</span>
                            </div>
                            <p class="text-gray-600 mb-3">强大的Java堆转储分析工具，提供详细的对象引用分析和泄漏检测功能。</p>
                            <p class="text-sm text-gray-500">关键功能：Leak Suspects报告、Dominators视图、对象保留链分析</p>
                        </div>
                        <div class="bg-white rounded-lg shadow-md p-6">
                            <div class="flex items-center mb-3">
                                <h4 class="text-lg font-medium text-gray-900">YourKit/JProfiler</h4>
                                <span class="ml-auto bg-yellow-100 text-yellow-800 text-xs font-medium px-2.5 py-0.5 rounded">商业</span>
                            </div>
                            <p class="text-gray-600">商业化的Java性能分析工具，提供深入的内存分析、泄漏检测和对象引用分析。</p>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <hr class="section-divider">

        <!-- Troubleshooting Steps Section -->
        <section id="troubleshooting" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="flex-shrink-0 h-12 w-12 rounded-full bg-yellow-100 flex items-center justify-center">
                    <i class="fas fa-bug text-yellow-600 text-xl"></i>
                </div>
                <h2 class="ml-4 text-3xl font-bold text-gray-900">内存泄漏排查步骤</h2>
            </div>

            <div class="mb-12">
                <h3 class="text-2xl font-semibold text-gray-800 mb-6">系统性排查流程</h3>
                <div class="space-y-4">
                    <div class="flex items-start">
                        <div class="flex-shrink-0 mt-1.5">
                            <div class="h-6 w-6 rounded-full bg-indigo-100 flex items-center justify-center">
                                <span class="text-indigo-600 font-bold text-sm">1</span>
                            </div>
                        </div>
                        <div class="ml-4">
                            <h4 class="text-lg font-medium text-gray-900">症状识别</h4>
                            <p class="text-gray-600">使用监控工具观察内存占用是否异常增长，检查应用日志中是否有内存相关的警告或错误信息。</p>
                        </div>
                    </div>
                    <div class="flex items-start">
                        <div class="flex-shrink-0 mt-1.5">
                            <div class="h-6 w-6 rounded-full bg-indigo-100 flex items-center justify-center">
                                <span class="text-indigo-600 font-bold text-sm">2</span>
                            </div>
                        </div>
                        <div class="ml-4">
                            <h4 class="text-lg font-medium text-gray-900">初步分析</h4>
                            <p class="text-gray-600">使用jstat监控JVM内存使用和垃圾回收，使用jmap生成堆转储文件。</p>
                        </div>
                    </div>
                    <div class="flex items-start">
                        <div class="flex-shrink-0 mt-1.5">
                            <div class="h-6 w-6 rounded-full bg-indigo-100 flex items-center justify-center">
                                <span class="text-indigo-600 font-bold text-sm">3</span>
                            </div>
                        </div>
                        <div class="ml-4">
                            <h4 class="text-lg font-medium text-gray-900">详细分析</h4>
                            <p class="text-gray-600">使用MAT分析堆转储，检查对象引用链和内存占用最高的对象。</p>
                        </div>
                    </div>
                    <div class="flex items-start">
                        <div class="flex-shrink-0 mt-1.5">
                            <div class="h-6 w-6 rounded-full bg-indigo-100 flex items-center justify-center">
                                <span class="text-indigo-600 font-bold text-sm">4</span>
                            </div>
                        </div>
                        <div class="ml-4">
                            <h4 class="text-lg font-medium text-gray-900">修复和优化</h4>
                            <p class="text-gray-600">根据分析结果修复代码中的内存泄漏问题，优化内存使用。</p>
                        </div>
                    </div>
                    <div class="flex items-start">
                        <div class="flex-shrink-0 mt-1.5">
                            <div class="h-6 w-6 rounded-full bg-indigo-100 flex items-center justify-center">
                                <span class="text-indigo-600 font-bold text-sm">5</span>
                            </div>
                        </div>
                        <div class="ml-4">
                            <h4 class="text-lg font-medium text-gray-900">验证和监控</h4>
                            <p class="text-gray-600">重新测试应用程序，持续监控内存使用情况确保问题已解决。</p>
                        </div>
                    </div>
                </div>
            </div>

            <h3 class="text-2xl font-semibold text-gray-800 mb-6">常见内存泄漏模式</h3>
            <div class="grid md:grid-cols-3 gap-6">
                <div class="bg-white rounded-lg shadow-md p-6">
                    <div class="flex items-center mb-3">
                        <div class="flex-shrink-0 h-10 w-10 rounded-full bg-red-100 flex items-center justify-center">
                            <i class="fas fa-database text-red-600"></i>
                        </div>
                        <h4 class="ml-3 text-lg font-medium text-gray-900">未关闭的资源</h4>
                    </div>
                    <p class="text-gray-600">数据库连接、文件流等资源未正确关闭导致的内存泄漏。</p>
                </div>
                <div class="bg-white rounded-lg shadow-md p-6">
                    <div class="flex items-center mb-3">
                        <div class="flex-shrink-0 h-10 w-10 rounded-full bg-yellow-100 flex items-center justify-center">
                            <i class="fas fa-boxes text-yellow-600"></i>
                        </div>
                        <h4 class="ml-3 text-lg font-medium text-gray-900">静态集合</h4>
                    </div>
                    <p class="text-gray-600">静态集合中存放对象导致对象无法被垃圾回收。</p>
                </div>
                <div class="bg-white rounded-lg shadow-md p-6">
                    <div class="flex items-center mb-3">
                        <div class="flex-shrink-0 h-10 w-10 rounded-full bg-green-100 flex items-center justify-center">
                            <i class="fas fa-bell text-green-600"></i>
                        </div>
                        <h4 class="ml-3 text-lg font-medium text-gray-900">监听器未注销</h4>
                    </div>
                    <p class="text-gray-600">事件监听器未在适当时候注销导致的对象持有。</p>
                </div>
            </div>
        </section>

        <hr class="section-divider">

        <!-- Prevention Section -->
        <section id="prevention" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="flex-shrink-0 h-12 w-12 rounded-full bg-green-100 flex items-center justify-center">
                    <i class="fas fa-shield-alt text-green-600 text-xl"></i>
                </div>
                <h2 class="ml-4 text-3xl font-bold text-gray-900">监控与预防</h2>
            </div>

            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div>
                    <h3 class="text-2xl font-semibold text-gray-800 mb-6">监控策略</h3>
                    <div class="space-y-6">
                        <div class="bg-white rounded-lg shadow-md p-6">
                            <div class="flex items-center mb-3">
                                <div class="flex-shrink-0 h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center">
                                    <i class="fas fa-desktop text-blue-600"></i>
                                </div>
                                <h4 class="ml-3 text-lg font-medium text-gray-900">系统监控工具</h4>
                            </div>
                            <p class="text-gray-600">使用top、htop、vmstat等工具实时监控系统资源使用情况。</p>
                        </div>
                        <div class="bg-white rounded-lg shadow-md p-6">
                            <div class="flex items-center mb-3">
                                <div class="flex-shrink-0 h-10 w-10 rounded-full bg-purple-100 flex items-center justify-center">
                                    <i class="fas fa-chart-bar text-purple-600"></i>
                                </div>
                                <h4 class="ml-3 text-lg font-medium text-gray-900">APM工具</h4>
                            </div>
                            <p class="text-gray-600">部署Prometheus + Grafana或New Relic等应用性能监控工具，设置内存使用告警。</p>
                        </div>
                    </div>
                </div>
                <div>
                    <h3 class="text-2xl font-semibold text-gray-800 mb-6">预防措施</h3>
                    <div class="space-y-6">
                        <div class="bg-white rounded-lg shadow-md p-6">
                            <div class="flex items-center mb-3">
                                <div class="flex-shrink-0 h-10 w-10 rounded-full bg-green-100 flex items-center justify-center">
                                    <i class="fas fa-code text-green-600"></i>
                                </div>
                                <h4 class="ml-3 text-lg font-medium text-gray-900">编码规范</h4>
                            </div>
                            <p class="text-gray-600">遵循内存管理最佳实践，避免常见的内存泄漏模式。</p>
                        </div>
                        <div class="bg-white rounded-lg shadow-md p-6">
                            <div class="flex items-center mb-3">
                                <div class="flex-shrink-0 h-10 w-10 rounded-full bg-yellow-100 flex items-center justify-center">
                                    <i class="fas fa-flask text-yellow-600"></i>
                                </div>
                                <h4 class="ml-3 text-lg font-medium text-gray-900">压力测试</h4>
                            </div>
                            <p class="text-gray-600">定期进行压力测试，模拟高负载场景下的内存使用情况。</p>
                        </div>
                    </div>
                </div>
            </div>

            <h3 class="text-2xl font-semibold text-gray-800 mb-6">内存优化技巧</h3>
            <div class="grid md:grid-cols-2 gap-6">
                <div class="bg-white rounded-lg shadow-md p-6">
                    <div class="flex items-center mb-3">
                        <div class="flex-shrink-0 h-10 w-10 rounded-full bg-indigo-100 flex items-center justify-center">
                            <i class="fas fa-recycle text-indigo-600"></i>
                        </div>
                        <h4 class="ml-3 text-lg font-medium text-gray-900">资源管理</h4>
                    </div>
                    <ul class="text-gray-600 space-y-2">
                        <li class="list-item">使用try-with-resources确保资源关闭</li>
                        <li class="list-item">及时释放数据库连接和文件句柄</li>
                        <li class="list-item">避免在finally块中抛出异常</li>
                    </ul>
                </div>
                <div class="bg-white rounded-lg shadow-md p-6">
                    <div class="flex items-center mb-3">
                        <div class="flex-shrink-0 h-10 w-10 rounded-full bg-pink-100 flex items-center justify-center">
                            <i class="fas fa-cubes text-pink-600"></i>
                        </div>
                        <h4 class="ml-3 text-lg font-medium text-gray-900">数据结构优化</h4>
                    </div>
                    <ul class="text-gray-600 space-y-2">
                        <li class="list-item">选择合适的数据结构减少内存占用</li>
                        <li class="list-item">使用WeakReference或SoftReference管理缓存</li>
                        <li class="list-item">避免过度使用静态集合</li>
                    </ul>
                </div>
            </div>
        </section>
    </div>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-8">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="text-center">
                <h3 class="text-lg font-medium mb-2">技术小馆</h3>
                <a href="http://www.yuque.com/jtostring" class="text-indigo-400 hover:text-indigo-300 transition duration-300">http://www.yuque.com/jtostring</a>
            </div>
        </div>
    </footer>

    <!-- Back to Top Button -->
    <button onclick="topFunction()" id="backToTop" class="floating-button hidden bg-indigo-600 hover:bg-indigo-700 text-white p-4 rounded-full shadow-lg">
        <i class="fas fa-arrow-up"></i>
    </button>

    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <script>
        // Back to top button
        window.onscroll = function() {
            scrollFunction()
        };

        function scrollFunction() {
            if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 300) {
                document.getElementById("backToTop").classList.remove("hidden");
            } else {
                document.getElementById("backToTop").classList.add("hidden");
            }
        }

        function topFunction() {
            document.body.scrollTop = 0;
            document.documentElement.scrollTop = 0;
        }

        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```